package com.example.sentinel.Interface;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.example.sentinel.application.Impl.CoreBizService;
import com.example.sentinel.domain.Result;
import com.example.sentinel.infrastructure.annotation.SentinelLog;
import com.example.sentinel.infrastructure.handler.SentinelExceptionHandler;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/api/data")
@CrossOrigin
public class CoreBizController {
    @Resource
    private CoreBizService coreBizService;
    @RequestMapping("/process")
    @SentinelResource(value = "processResource",
                    blockHandlerClass = SentinelExceptionHandler.class,
                    blockHandler = "handleBlock",
                    fallbackClass = SentinelExceptionHandler.class,
                    fallback = "handleFallback")   
    @SentinelLog
    public Result process(){
        return coreBizService.process();
    }
    
}
